package com.runen.wnhz.runen.ui.activity;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class BasicActivity extends AppCompatActivity {

    private ProgressDialog progressDialog;

    public SharedPreferences preferences;

    public SharedPreferences.Editor editor;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        progressDialog = new ProgressDialog(this);
        progressDialog.setTitle("提示");
        progressDialog.setMessage("正在努力加载...");
        progressDialog.setCanceledOnTouchOutside(true);
        progressDialog.setCancelable(true);
        preferences = getSharedPreferences("user_seeting", Context.MODE_PRIVATE);
        editor = preferences.edit();
    }

    public void showProgressDialog(){
        if(progressDialog != null) {
            progressDialog.show();
        }
    }

    public void dismissDialog(){
        if(progressDialog != null){
            if(progressDialog.isShowing()){
                progressDialog.dismiss();
            }
        }
    }
}
